package org.apache.dubbo.demo.consumer.example.eg11;

import org.apache.dubbo.demo.example.eg11.DemoService;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Application {

  public static void main(String[] args) {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:example/eg11/applicationContext.xml");
    DemoService demoService = (DemoService) context.getBean("demoService");
    String result = demoService.sayHello("xufeng");
    boolean consumerSide = RpcContext.getContext().isConsumerSide();
    String remoteHost = RpcContext.getContext().getRemoteHost();
    String application = RpcContext.getContext().getUrl().getParameter("application");
    System.out.println("consumerSide: " + consumerSide + ", remoteHost: " + remoteHost + ", application: " + application);
    System.out.println("**************************** result: " + result + " ****************************");

  }

}
